#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/io.h>
#include "dev_info.h"

int mydrv_probe(struct device *dev)
{
	printk("---------------%s--------------\n", __FUNCTION__);

	struct mydev_desc *pdesc = (struct mydev_desc *)dev->platform_data;
	
	printk("name = %s\n", pdesc->name);
	printk("irqno = %d\n", pdesc->irqno);


}


int mydrv_remove(struct device *dev)
{	
	printk("---------------%s--------------\n", __FUNCTION__);
	return 0;
}

extern struct bus_type mybus;

struct device_driver mydrv = {
	.name = "fsdev_drv",
	.bus = &mybus,
	.probe = mydrv_probe,
	.remove = mydrv_remove
};


static int __init mydrv_init(void)
{
	int ret;
	printk("---------------%s--------------\n", __FUNCTION__);

	//将driver注册到总线中
	ret = driver_register(&mydrv);
	if(ret < 0)
	{
		printk("device_register error\n");
		return ret;
	}

	return 0;

}


static void __exit mydrv_exit(void)
{
	printk("---------------%s--------------\n", __FUNCTION__);
	driver_unregister(&mydrv);

}


module_init(mydrv_init);
module_exit(mydrv_exit);
MODULE_LICENSE("GPL");

